<template>
	<view>
		<view class="" style="background-color: #1262DB;display: flex;justify-content: space-between;padding: 30rpx;align-items: center;" v-if="Object.keys(datalist).length > 0">
			<view class="" style="display: flex;align-items: center;">
				<view class="">
					<image :src="url+datalist.avatar" style="width:120rpx;height:120rpx;border-radius: 50%;" mode=""></image>
				</view>
				<view class="" style="display: flex;flex-direction: column;color: #fff;margin-left: 20rpx;">
					<view class="" style="font-size: 36rpx;">
						{{datalist.nickname}}
					</view>
					<view class="" style="font-size: 26rpx;margin-top: 10rpx;">
						手机号：{{datalist.mobile}}
					</view>
				</view>
			</view>
			<view class="">
				<image src="../../static/index/set.png" style="width: 50rpx;height:50rpx;" mode=""></image>
			</view>
		</view>
		<view class="" v-if="Object.keys(datalist).length > 0" style="background-color: #1262DB;display: flex;justify-content: space-between;padding: 0rpx 50rpx 30rpx 50rpx;align-items: center;">
			<view class="ccs">
				<view class="da">
					{{datalist.age == '' || datalist.age == null ? '未知' :datalist.age}}
				</view>
				<view class="xiao">
					年龄
				</view>
			</view>
			<view class="ccs">
				<view class="da">
					{{datalist.hz_height == '' || datalist.hz_height == null ? '未知' : datalist.hz_height}}
				</view>
				<view class="xiao">
					身高
				</view>
			</view>
			<view class="ccs">
				<view class="da">
					{{datalist.hz_weight == '' || datalist.hz_weight == null ? '未知' : datalist.hz_weight}}
				</view>
				<view class="xiao">
					体重
				</view>
			</view>
			<view class="ccs">
				<view class="da">
					{{datalist.gender == 1 ? '男' : '女'}}
				</view>
				<view class="xiao">
					性别
				</view>
			</view>
			
		</view>
		
		<view class="itbox">
			<view class="ccs" @click="gourl('/pages/checkorder/myorder')">
				<view class="">
					<image :src="url+imglist[0]" class="tb" mode=""></image>
				</view>
				<view class="" style="color: #000;font-size: 25rpx;">
					订单管理
				</view>
			</view>
			<view class="ccs">
				<view class="">
					<image :src="url+imglist[1]" class="tb" mode=""></image>
				</view>
				<view class="" style="color: #000;font-size: 25rpx;">
					体检报告
				</view>
			</view>
			<view class="ccs">
				<view class="">
					<image :src="url+imglist[2]" class="tb" mode=""></image>
				</view>
				<view class="" style="color: #000;font-size: 25rpx;">
					检测下单
				</view>
			</view>
			<view class="ccs" @click="gourl('/pages/hz_my/personal_data')">
				<view class="">
					<image :src="url+imglist[3]" class="tb" mode=""></image>
				</view>
				<view class="" style="color: #000;font-size: 25rpx;">
					个人资料
				</view>
			</view>
		</view>
		<view class="itbox2">
			<view class="" style="font-weight: bold;">
				健康头条
			</view>
			<view class="xian"></view>
			<view class="" style="display: flex;margin-top: 15rpx;" v-for="(item,index) in tt_data">
				<view class="">
					<image :src="url+item.coverimg" style="width: 170rpx;height: 170rpx" mode=""></image>
				</view>
				<view class="" style="display: flex;flex-direction: column;margin-left: 20rpx;justify-content: space-around;width:100%">
					<view class="">
						{{item.title}}
					</view>
					<view class="" style="font-size: 25rpx;">
						{{item.subtitle}}
					</view>
					<view class="" style="text-align: right;font-size: 24rpx;color: #cfcfcf;width: 100%;">
						{{item.createtime}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				imglist: [
					'wechatimg/c1.png',
					'wechatimg/c2.png',
					'wechatimg/c3.png',
					'wechatimg/c4.png',
					
				],
				datalist:{},
				tt_data:[]
			}
		},
		onShow() {
			this.getdata()
			this.toutiao()
		},
		methods: {
			toutiao(){
				var that = this
				uni.request({
					url: that.global.url + 'api/classroom/index',
					method: 'POST',
					header:{'token':uni.getStorageSync('hz_token')},
					data: {
						type:2,
						page:0
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							// 存用户信息
							that.tt_data = result.data.data
						} else {
							uni.showToast({
								title: result.msg,
								icon: 'none'
							})
						}
					},
					complete() {
						// uni.hideLoading()
					}
				})
			},
			getdata(){
				var that = this
				uni.request({
					url: that.global.url + 'api/user/hz_center',
					method: 'POST',
					header:{'token':uni.getStorageSync('hz_token')},
					data: {
						
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							// 存用户信息
							that.datalist = result.data
						} else {
							uni.showToast({
								title: result.msg,
								icon: 'none'
							})
						}
					},
					complete() {
						// uni.hideLoading()
					}
				})
			},
			gourl(url){
				if(uni.getStorageSync('hz_userinfo')){
					uni.navigateTo({
						url:url
					})
				}else{
					uni.navigateTo({
						url:'/pages/login/login'
					})
				}
			}
		}
	}
</script>

<style>
	page{
		background-color: #f1f1f1;
	}
.ccs{
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	color: #fff;
}
.da{
	font-size: 34rpx;
}
.tb{
	width: 60rpx;
	height: 60rpx;
}
.itbox{
	display: flex;
	justify-content: space-between;
	width: 80%;
	padding: 30rpx;
	background-color: #fff;
	border-radius: 15rpx;
	/* border: 1px solid #ccc; */
	margin: 0px auto;
	margin-top: 30rpx;
	box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1);
}
.itbox2{
	
	width: 80%;
	padding: 30rpx;
	background-color: #fff;
	border-radius: 15rpx;
	/* border: 1px solid #ccc; */
	margin: 0px auto;
	margin-top: 30rpx;
	box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1);
}
.xiao{
	font-size: 28rpx;
}
.xian{
	border-bottom: 1px solid #efefef;
	margin: 15rpx 0rpx;
}
</style>
